<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>跟随鼠标移动的点</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            height: 100vh;
            background-color: #f0f0f0;
            overflow: hidden;
            cursor: none;
        }

        .dot {
            position: absolute;
            width: 40px;
            height: 40px;
            background-color: #ff6b6b;
            border-radius: 50%;
            pointer-events: none;
        }
    </style>
</head>

<body>
    <div class="dot"></div>
    <script>
        const dot = document.querySelector('.dot')

        document.addEventListener('mousemove', (e) => {
            // 直接更新点的位置到鼠标位置
            dot.style.left = (e.clientX - 20) + 'px';
            dot.style.top = (e.clientY - 20) + 'px';
        });
    </script>
</body>

</html>